package weapons;

import iterfaces.Ships;
import controllers.Map;
import controllers.Point;
import controllers.State;
import ships.Destroyer;
import ships.Frigate;


/**
 * @author 508461
 * @version 1.0
 * @created 24-mei-2012 12:47:47
 */
public class Canon extends Weaponsystem {
	
	private static final int MAGAZINE_SIZE 						= 50;
	private static final int MAX_HEALTHPOINTS_BEFORE_SHUTDOWN	= 30; //in %
	private static final int RELOAD_TIME 						= 60; //sec	
	private static final int MAGAZINE_AMOUNT 					= 500;
	private static final int FIRE_RATE 							= (1/5); //= 1bullet/5 seconde
	private int remainingBullets;
	
	private Canonball canonball;
	private Ships ship;

	public static void main(String[] args){
		// Test de verbonden classes.
		//new Canon();
	}
	
	public Canon(Ships ship){
		
		super(State.Online , MAGAZINE_SIZE, MAX_HEALTHPOINTS_BEFORE_SHUTDOWN, RELOAD_TIME, MAGAZINE_AMOUNT, FIRE_RATE);
		
		this.ship = ship;
		
		System.out.println("Instance " + this.getClass() + " created.");
	}
	
	public int getRemainingBullets(){
		return this.remainingBullets;
	}
	
	public void setRemainingBullets(int remainingBullets)
	{
		this.remainingBullets = remainingBullets;
	}
	
	public void shoot(Point point, Point shoot){
		Bullet canonball = new Canonball(this.ship.getPosition());
		//canonball.addWaypoint(canonball,point);
		canonball.setDrawWaypoints(false);
		Map.getMap().addDrawAbleObject(canonball);
		//Map.getMap().dObjects.get(Map.getMap().dObjects.size()-1).addWaypoint(Map.getMap().dObjects.get(Map.getMap().dObjects.size()-1), shoot);
		canonball.addWaypoint(canonball, shoot);
	}

	public void finalize() throws Throwable {

	}

}